#!/bin/bash

echo "🔍 检查博客系统状态..."

echo ""
echo "📊 服务状态："

# 检查数据库
if docker ps | grep -q blog_db; then
    echo "✅ 数据库 (PostgreSQL): 运行中"
else
    echo "❌ 数据库 (PostgreSQL): 未运行"
fi

# 检查Redis
if docker ps | grep -q blog_redis; then
    echo "✅ Redis: 运行中"
else
    echo "❌ Redis: 未运行"
fi

# 检查后端API
if curl -s http://localhost:8000/health > /dev/null 2>&1; then
    echo "✅ 后端API (FastAPI): 运行中"
else
    echo "❌ 后端API (FastAPI): 未运行"
fi

# 检查前端
if curl -s http://localhost:3000/ > /dev/null 2>&1; then
    echo "✅ 前端 (Vue3): 运行中"
else
    echo "❌ 前端 (Vue3): 未运行"
fi

echo ""
echo "📱 访问地址："
echo "   前端: http://localhost:3000"
echo "   后端API: http://localhost:8000"
echo "   API文档: http://localhost:8000/docs"
echo "   测试页面: http://localhost:3000/test"

echo ""
echo "🛠️  管理命令："
echo "   查看数据库日志: docker-compose -f docker-compose.simple.yml logs db"
echo "   查看Redis日志: docker-compose -f docker-compose.simple.yml logs redis"
echo "   停止服务: docker-compose -f docker-compose.simple.yml down"
echo "   停止前后端: pkill -f uvicorn && pkill -f 'npm run dev'"
